$(function () {
    let facilitiesId = localStorage.getItem("facilitiesId");
    findByFacilitiesId(facilitiesId);
});

function findByFacilitiesId(id) {
    let result = myAjax('/back/facilities/findByFacilitiesId','get',{id:id,token:$.cookie("token")});
    setData(result.facilitiesModel);//需要给数据  把后台数据拿到
}

function setData(data) {
    $("#facilitiesId").val(data.id);
    $("#type").val(data.type);
    $("#title").val(data.title);
    $("#author").val(data.author);
    $("#content").val(data.content);
    $("#releaseTime").val(data.releaseTime);
}

function facilitiesEdit() {
    let data = {};
    data.id = $("#facilitiesId").val();
    data.type = $("#type").val();
    data.title = $("#title").val();
    data.author = $("#author").val();
    data.content = $("#content").val();
    data.releaseTime = $("#releaseTime").val();
    data.token = $.cookie("token");
    let result = myAjax('/back/facilities/facilitiesEdit','post',data);
    if (result.result === 1) {
        alert("修改成功!");
        $("#right").load('/back/facilities/facilitiesManage.html');
    } else {
        alert("修改失败!")
    }
}
function cancelFcEdit() {
    $("#right").load('/back/facilities/facilitiesManage.html')
}